function [ Portfolio, CallPrice] = simpleHedge( Price, Strike, Time, r, sigma, miu, steps, nSim )
% This function use monte carlo to simulate 
% simple hedging and calculate the hedging error
% due to discrete hedging.
% Here we assume K > S0, option is out of money
assert(Price < Strike);

% Initialization
S0 = Price; K = Strike; T = Time;
N = steps; M = nSim;
dt = T/N;

% Time to expiry
t = T:-dt:0;
% Replace last time to expiration small value
t(N+1) = dt/1000;

% Now we simulate Monte Carlo asset prices
% Initialize Asset price, Bank account, Alpha Vector, Option Vector
[OptionCall0, OptionPut0] = blsprice(S0,K,r,T,sigma);

Alpha0 = zeros(M,1);
Option0 = OptionCall0*ones(M,1);
Bank0 = Option0;
AssetPrice = S0*ones(M,1);
% Time Stepping by vector
for i=1:N
    % Generate random vector of asset price
    dWt = randn(M,1);  % Wiener process
    multiple = exp((miu-0.5*sigma^2)*dt + sigma*sqrt(dt).*dWt);
    AssetPrice = AssetPrice.*multiple;

    % We now balance our portfolio based on the updated pric
    % First find new Alpha
    Alpha1 = AssetPrice > K;
    Bank1 = exp(r*dt)*Bank0 - AssetPrice.*(Alpha1 - Alpha0);
    
    % Update Hedging Parameter Vectors
    Alpha0 = Alpha1;
    Bank0 = Bank1;
end

% Now we get the final liquidation value for the portfolio at T
Portfolio = -max(AssetPrice-K,0) + Alpha1.*AssetPrice + Bank1;
% Discount the Portfolio to time 0
Portfolio = exp(-r*T)*Portfolio;
CallPrice = OptionCall0;

end

